import datetime

first_day = datetime.date(2021,7,14)
print(first_day) 
next_day=first_day+datetime.timedelta(days=21-1)
print(next_day)

# 计算2**0 + 2**1 + ... + 2**n
# n = int(input('input n: '))
# i = 0
# answer = 0
# while i < n:
#     answer += 3**i
#     print('i: %d, answer: %d' %(i,answer))
#     i+=1
# else:
#     print('answer is ',answer)

# 打印九九乘法表
i = 1 
while i<=9:
    j = i
    while j<=9:
        print (i,'×',j,'=',i*j,end='   ')
        j+=1
    print()
    i+=1
print()


# 出租车计费 根据里程n(km)计算打车费用
# 公里数3km內起步价6元, 3-10km每km1.8元,超过10km之后,超过部分再加50%
n = 15
price = 6
if n>3 and n < 10:
    price += (n-3)*1.8
elif n > 10:
    price += 7*1.8+(n-10)*1.8*(1+0.5)
print ( '总价',price,'元' )

# 将整数转为二进制
num = -1
print(f'将整数{num}转为二进制')
str=''
for i in range(31,-1,-1):
    # print(num&(1<<i))
    if num&(1<<i)==0:
        # print(0,end='')
        str+='0'
    else:
        str+='1'
        # print(1,end='')
print(str)
